<template>
  <div>
    <div v-for="item in nowplays" :key="item.filmId" class="item">
      <div class="left">
        <img :src="item.poster" />
      </div>
      <div class="middle">
        <div>{{ item.name }}</div>
        <div>
          <span>观众评分</span>
          <span>7.6</span>
        </div>
        <div>主演：{{ item.actors | actorsFilter }}</div>
        <div>美国，英国 | 150分钟</div>
      </div>
      <div class="right">
        <span>购票</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      default: "购票",
    },
    color: {
      default: "#ff5f16",
    },
    nowplays: Array,
  },
  data() {
    return {};
  },
  filters: {
    actorsFilter(value) {
      if (!value) {
        return "无";
      }
      //return value.map((item) => item.name).join(",");
      let actor = "";
      value.forEach((item) => {
        actor += item.name + ",";
      });
      return actor.slice(0,-2)
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  margin-top: 5px;
  display: flex;
  color: #797d82;
  font-size: 13px;
  .left {
    width: 30%;
    height: 100px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .middle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 55%;
    margin-left: 5px;
    div:nth-of-type(1) {
      color: #191a1b;
      font-size: 16px;
    }
    div:nth-of-type(3) {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  .right {
    width: 15%;
    display: flex;
    align-items: center;
    span {
      border: 1px solid #ff5f16;
      background: white;
      color: #ff5f16;
      border-radius: 2px;
      height: 25px;
      line-height: 25px;
      font-size: 13px;
      width: 50px;
      text-align: center;
    }
  }
}
</style>